HAL RCC secure attributes settings functions migration

This section provides information about the HAL RCC secure attributes settings operation functions migration.

HAL RCC configure security and privilege attributes function

Function description

In HAL1, the function HAL_RCC_ConfigAttributes() is used to configure security and privilege attributes of the RCC peripheral.

In HAL2, this functionality is split into two distinct functions to separately set the security and privilege attributes as follows:

  • HAL_RCC_SetSecAttr() to set the security attribute for the RCC peripheral.

  • HAL_RCC_SetPrivAttr() to set the privilege attribute for the RCC peripheral.

HAL1

HAL2

void HAL_RCC_ConfigAttributes(uint32_t Item, uint32_t Attributes)
hal_status_t HAL_RCC_SetSecAttr(uint32_t item, hal_rcc_sec_attr_t sec_attr)
hal_status_t HAL_RCC_SetPrivAttr(uint32_t item, hal_rcc_priv_attr_t priv_attr)

Note

  • RCC secure and privilege registers may vary between STM32 series, please refer to the specific series reference manual to get the available options.

Example usage

HAL1

HAL2

HAL_RCC_ConfigAttributes(RCC_HSE, RCC_SEC_PRIV);
HAL_RCC_SetSecAttr(HAL_RCC_SEC_ITEM_HSE, HAL_RCC_SEC);
HAL_RCC_SetPrivAttr(HAL_RCC_PRIV_ITEM_HSE, HAL_RCC_PRIV);

HAL RCC get security and privilege attributes function

Function description

In HAL1, the function HAL_RCC_GetConfigAttributes() retrieves the security and privilege attributes of the RCC peripheral.

In HAL2, this functionality is split into two distinct functions to separately obtain the security and privilege attributes as follows:

  • HAL_RCC_GetSecAttr() to get the security attribute of the RCC peripheral.

  • HAL_RCC_GetPrivAttr() to get the privilege attribute of the RCC peripheral.

HAL1

HAL2

HAL_StatusTypeDef HAL_RCC_GetConfigAttributes(uint32_t Item, uint32_t *pAttributes)
hal_rcc_sec_attr_t HAL_RCC_GetSecAttr(uint32_t item)
hal_rcc_priv_attr_t HAL_RCC_GetPrivAttr(uint32_t item)

Note

  • RCC secure and privilege registers may vary between STM32 series, please refer to the specific series reference manual to get the available options.

Example usage

HAL1

HAL2

uint32_t attr;
HAL_RCC_GetConfigAttributes(RCC_HSE, &attr);
HAL_StatusTypeDef sec_status;
HAL_StatusTypeDef priv_status;
sec_status = HAL_RCC_GetSecAttr(HAL_RCC_SEC_ITEM_HSE);
priv_status = HAL_RCC_GetPrivAttr(HAL_RCC_PRIV_ITEM_HSE);